package com.x.Part5_String.StringJoiner;

import java.util.StringJoiner;

/**
 * ClassName: Test
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.03.15 11:48
 */
public class Test {
    public static void main(String[] args) {

        //StringJoiner类无空参构造器
        StringJoiner sj1 = new StringJoiner(",");
        StringJoiner sj2 = new StringJoiner(",","[","]");

        String str1 = sj1.add("a").add("b").add("c").toString();
        String str2 = sj2.add("a").add("b").add("c").toString();

        System.out.println(str1);//a,b,c
        System.out.println(str2);//[a,b,c]


    }
}
